package controller

import (
	"common"
	"github.com/gin-gonic/gin"
	"net/http"
)

func Login(content *gin.Context) {
	var loginUser LoginUser
	if err := content.BindJSON(&loginUser); err != nil {
		content.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
	}
	if loginUser.Name == "super" && loginUser.Pass == "123456" {
		content.JSON(http.StatusOK, common.SuccessResult("用户名登录成功"))
	} else {
		content.JSON(http.StatusBadRequest, common.ErrResult("用户名密码错误"))
	}
}
